#!/bin/sh

# Slackware build script for murrine-themes

# Copyright 2011  Petar Petrov, ppetrov@paju.oulu.fi
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Many thanks to Debian for bundling all these themes together!

PRGNAM=murrine-themes
VERSION=${VERSION:-0.98.3}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

ARCH=noarch

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/${PRGNAM}_${VERSION}.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

# Include only the gtk-2.0 themes and give them more consistent names.
cd usr/share/themes
install -D -m644 Albatross/gtk-2.0/gtkrc 		 \
                 $PKG/usr/share/themes/Murrine-Albatross/gtk-2.0/gtkrc
install -D -m644 Bluebird/gtk-2.0/gtkrc			 \
                 $PKG/usr/share/themes/Murrine-Bluebird/gtk-2.0/gtkrc
install -D -m644 greybird/gtk-2.0/gtkrc			 \
                 $PKG/usr/share/themes/Murrine-Greybird/gtk-2.0/gtkrc
install -D -m644 Kiwi/gtk-2.0/gtkrc			 \
                 $PKG/usr/share/themes/Murrine-Kiwi/gtk-2.0/gtkrc
install -D -m644 MurrinaAquaIsh/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-AquaIsh/gtk-2.0/gtkrc
install -D -m644 MurrinaAzul/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Azul/gtk-2.0/gtkrc
install -D -m644 MurrinaBlau/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Blau/gtk-2.0/gtkrc
install -D -m644 MurrinaBleu/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Bleu/gtk-2.0/gtkrc
install -D -m644 MurrinaBlu/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Blu/gtk-2.0/gtkrc
install -D -m644 MurrinaBlue/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Blue/gtk-2.0/gtkrc
install -D -m644 MurrinaCandido/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Candido/gtk-2.0/gtkrc
install -D -m644 MurrinaCandy/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Candy/gtk-2.0/gtkrc
install -D -m644 MurrinaCappuccino/gtk-2.0/gtkrc	 \
                 $PKG/usr/share/themes/Murrine-Cappuccino/gtk-2.0/gtkrc
install -D -m644 MurrinaChrome/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Chrome/gtk-2.0/gtkrc
install -D -m644 MurrinaCream/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Cream/gtk-2.0/gtkrc
install -D -m644 MurrinaCrystal/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Crystal/gtk-2.0/gtkrc
install -D -m644 MurrinaCrystalCurve/gtk-2.0/gtkrc	 \
                 $PKG/usr/share/themes/Murrine-CrystalCurve/gtk-2.0/gtkrc
install -D -m644 MurrinaCrystalHuman/gtk-2.0/gtkrc	 \
                 $PKG/usr/share/themes/Murrine-CrystalHuman/gtk-2.0/gtkrc
install -D -m644 MurrinaCrystalLine/gtk-2.0/gtkrc	 \
                 $PKG/usr/share/themes/Murrine-CrystalLine/gtk-2.0/gtkrc
install -D -m644 MurrinaEalm/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Ealm/gtk-2.0/gtkrc
install -D -m644 MurrinaElement/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Element/gtk-2.0/gtkrc
install -D -m644 MurrinaFancyCandy/gtk-2.0/gtkrc	 \
                 $PKG/usr/share/themes/Murrine-FancyCandy/gtk-2.0/gtkrc
install -D -m644 MurrinaGilouche/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Gilouche/gtk-2.0/gtkrc
install -D -m644 MurrinaLoveGray/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-LoveGray/gtk-2.0/gtkrc
install -D -m644 MurrinaNeoGraphite/gtk-2.0/gtkrc	 \
                 $PKG/usr/share/themes/Murrine-NeoGraphite/gtk-2.0/gtkrc
install -D -m644 MurrinaVerdeOlivo/gtk-2.0/gtkrc	 \
                 $PKG/usr/share/themes/Murrine-VerdeOlivo/gtk-2.0/gtkrc
install -D -m644 Murrine-Gray/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Gray/gtk-2.0/gtkrc
install -D -m644 Murrine-Light/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Light/gtk-2.0/gtkrc
install -D -m644 Murrine-Sky/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Sky/gtk-2.0/gtkrc
install -D -m644 NOX/gtk-2.0/gtkrc			 \
                 $PKG/usr/share/themes/Murrine-NOX/gtk-2.0/gtkrc
install -D -m644 Orangine/gtk-2.0/gtkrc			 \
                 $PKG/usr/share/themes/Murrine-Orangine/gtk-2.0/gtkrc
install -D -m644 shearwater/gtk-2.0/gtkrc		 \
                 $PKG/usr/share/themes/Murrine-Shearwater/gtk-2.0/gtkrc

cd $TMP/$PRGNAM-$VERSION/debian
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a changelog copyright README $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
